package window;

import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.IntellitypeListener;
import com.melloware.jintellitype.JIntellitype;
import handle.ExcelTool;
import handle.HotKeyRegistrant;
import handle.imp.DefaultHotKeyRegistrant;
import util.FrameUtil;

import javax.swing.*;
import java.io.File;

/**
 * @description: 主窗口 不要忘记重写接口中的方法
 * @author: ziger
 * @time: 2022/9/9 16:35
 */
public abstract class ExcelPasterFrame extends JFrame implements HotkeyListener, IntellitypeListener {
    protected static ExcelTool tool;

    protected TopFrame topFrame = null;
    protected ConfigFrame configFrame = null;
    protected HotKeyRegistrant hotKeyRegistrant;

    public ExcelPasterFrame(){
        System.out.println(new File(".").getAbsolutePath());
        // first check to see if an instance of this application is already
        // running, use the name of the window title of this JFrame for checking
        if (JIntellitype.checkInstanceAlreadyRunning("JIntellitype Test Application")) {
            System.exit(1);
        }

        // next check to make sure JIntellitype DLL can be found and we are on
        // a Windows operating System
        if (!JIntellitype.isJIntellitypeSupported()) {
            System.exit(1);
        }

        setTitle("Excel全局复制助手");
        setVisible(true);

        hotKeyRegistrant = new DefaultHotKeyRegistrant();
    }


    /**
     * 设定ExcelTool供其他组件操作
     * @param tool1
     */
    public static void setTool(ExcelTool tool1) {
        tool = tool1;
    }


}
